package com.yanggu.common.satoken;

import cn.dev33.satoken.stp.StpInterface;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * sa-token配置
 */
@Configuration
public class SaTokenConfig {

    /**
     * 拦截器
     */
    @Bean
    public SaTokenInterceptor getSaTokenInterceptor() {
        return new SaTokenInterceptor();
    }

    /**
     * 权限接口实现(使用bean注入方便用户替换)
     */
    @Bean
    public StpInterface stpInterface() {
        return new SaPermissionImpl();
    }

    /**
     * 异常处理器
     */
    @Bean
    public SaTokenExceptionHandler saTokenExceptionHandler() {
        return new SaTokenExceptionHandler();
    }

}
